/*
 * Copyright (C) 2008-2009 the original author or authors
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *         http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.code.liquidform.internal.managedobjects;

import com.google.code.liquidform.internal.AliasFactory;

/**
 * Holds information about either
 * <ul>
 * <li>a property invocation that occurred on some object managed by the
 * Framework (eg. p.getAddress() is tracked as <tt>p.address</tt>)</li>
 * <li>a persistent type binding (eg. in "from Person as p", the target is
 * tracked as being of type <tt>Person</tt>).</li>
 * </ul>
 * 
 * @see AliasFactory
 * @see AliasedFrameworkManagedObject
 */
public abstract class FrameworkManagedObject {

	/**
	 * Return a String representation about this expression.
	 */
	public abstract String getTargetRepresentation();

	/**
	 * Return the preferred string representation for this object. That is, if
	 * it is {@link AliasedFrameworkManagedObject}, return the alias, else just
	 * return the {@link #getTargetRepresentation() target representation}.
	 * 
	 */
	public String getPreferredStringRepresentation() {
		return getTargetRepresentation();
	}

	/**
	 * For debug purposes only. Use {@link #getPreferredStringRepresentation()}
	 * or {@link #getTargetRepresentation()} to construct user-visible
	 * representations.
	 */
	@Override
	public String toString() {
		return "FMO[" + getTargetRepresentation() + "]";
	}

}
